<template>
  <div class="examine ">
    <mt-header fixed title="审核">
      <router-link to="/user" replace slot="left">
        <mt-button icon="back">返回</mt-button>
      </router-link>
    </mt-header>
    <div class="list">
      <div v-for="(item, index) in list" :key="index" class="info">
        <div class="updata">
          <span>Lv{{item.current}}</span>
          <img src="../assets/img/箭头.png" alt="">
          <span>Lv{{item.down}}</span>
        </div>
        <div class="time">申请时间 ：{{item.updateTime}}</div>
        <div class="time wx">微信号 :  {{item.wechatNumber}}</div>
        <div class="time">手机号 :  {{item.phone}}</div>
        <div class="btn">
          <div class="ignore" @click="ignore(item.id)">忽略</div>
          <div class="comfort" @click="comfort(item.id)">确认</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { Indicator, Toast } from 'mint-ui'
export default {
  data () {
    return {
      list: []
    }
  },
  mounted () {
    Indicator.open()
    this.getInfo()
  },
  methods: {
    async getInfo () {
      let that = this
      let res = await that.$api({
        method: 'post',
        url: '/app/examine/examine'
      })
      try {
        if (res.success) {
          Indicator.close()
          this.list = res.data
        } else {
          Toast(res.msg)
        }
      } catch (error) {
        console.log(error)
        Indicator.close()
      }
    },
    async ignore (ids) {
      let that = this
      let res = await that.$api({
        method: 'post',
        url: '/app/examine/refuseExamine',
        params: {
          id: ids
        }
      })
      try {
        if (res.success) {
          Indicator.close()
          this.list = res.data
          this.getInfo()
        } else {
          Toast(res.msg)
        }
      } catch (error) {
        console.log(error)
        Indicator.close()
      }
    },
    async comfort (ids) {
      let that = this
      let res = await that.$api({
        method: 'post',
        url: '/app/examine/agreeExamine',
        params: {
          id: ids
        }
      })
      try {
        if (res.success) {
          Indicator.close()
          this.list = res.data
          this.getInfo()
        } else {
          Toast(res.msg)
        }
      } catch (error) {
        console.log(error)
        Indicator.close()
      }
    }
  }
}
</script>

<style scoped lang='less'>
.list{
  padding: .2rem;
  margin-top: .3rem;
  .info{
    padding: .14rem .12rem;
    background: #fff;
    box-shadow: 0px 2px 3px #666;
    padding: .2rem .12rem;
    margin-top: .1rem;
    border-radius: .06rem;
    .updata{
      display: flex;
      font-size: .2rem;
      align-items: center;
      // justify-content: center;
      margin-bottom: .24rem;
      span{
        width: 0.64rem;
        height: 0.64rem;
        border-radius: 50%;
        border: 1px solid #1395da;
        text-align: center;
        line-height: .64rem;
      }
      img{
        height: .32rem;
        margin: 0 .3rem;
      }
    }
    .time{
      font-size: .14rem;
      color: #000;
    }
    .wx{
      margin:.06rem 0;
    }
    .btn{
      display: flex;
      align-items: center;
      font-size: .16rem;
      justify-content: flex-end;
      color: #fff;
      .ignore{
        color: #666;
        margin-right: .24rem;
      }
      .comfort{
        padding: .08rem .3rem;
        background: #1395da;
      }
    }

  }
}
</style>
